$.ajaxPrefilter(function(options){
    // console.log(options.url);
    options.url = 'http://api-breakingnews-web.itheima.net/' +options.url
    console.log(options.url);

    // 统一添加请求头
    if(options.url.includes('/my/')) {
        options.headers = {Authorization : localStorage.token||''}
        options.complete = function(e){
            // console.log(e);
            if(e.responseJSON.status ===1 && e.responseJSON.message ==='身份认证失败！') {
                // 清除本地存储
                localStorage.removeItem('token')
                // 跳转登录页面
                location.href ='/login.html' 
            }
        }
    }

})